<%
        interactive = true if local_assigns[:interactive].nil? #or current_user.nil?
        if not interactive
                other_schedules = current_user.schedules.reject {|s| s.id == @schedule.id}
        elsif current_user != nil
                other_schedules = current_user.schedules
        else
                other_schedules = nil
        end
%>
<p>
<% if interactive %>
Viewing your working schedule. <%= button_to_remote("clear working schedule", :url=>{:action=>"clear_schedule"}, :complete=>'alert("Working schedule cleared!");window.location.reload()')%>
<% else %>
Viewing your schedule saved at <%= @schedule.created_at.month %>/<%= @schedule.created_at.day %>/<%= @schedule.created_at.year %>
<%= "%02d" % @schedule.created_at.hour %>:<%= "%02d" % @schedule.created_at.min %>:<%= "%02d" % @schedule.created_at.sec %>
<% end %>
</p>
<% if logged_in? %>
<div id="saved_schedules">
        <p>
        <% if other_schedules.length == 0 %>
        You have no<% if not interactive %> other<% end %> saved schedules.
        <% else %>
        You have <% if not interactive %> other<% end %> saved schedules created at:
                <% for schedule in other_schedules %>
                <span>
                        <% link_to schedule do%>
                        <%= schedule.created_at.month %>/<%= schedule.created_at.day %>/<%= schedule.created_at.year %>
                        <%= "%02d" % schedule.created_at.hour %>:<%= "%02d" % schedule.created_at.min %>:<%= "%02d" % schedule.created_at.sec %>
                        <% end %> &nbsp;
                </span>
                <% end %>
        <% end %>
        </p>
                <% if not interactive %>
                <%= button_to_remote("Set this schedule as working schedule", :url => {:action => "copy_to_working_schedule", :id => @schedule.id}, :complete => 'alert("Working schedule set! Returning to working schedule..."); window.location = "/schedules"')%>
                <%= button_to "Delete this schedule", {:action => "delete", :id => @schedule.id }, :confirm => "Delete this schedule and return to your working schedule?"%>
                <%= link_to "Return to working schedule", schedules_path() %>
                <% end %>
</div>
<% end %>